Feat: nexchange plugin#212
Conversation
|
@cursor review |
Bugbot couldn't runBugbot is not enabled for your user on this team. Ask your team administrator to increase your team's hard limit for Bugbot seats or add you to the allowlist in the Cursor dashboard. |
1adc15c to
4bd3686
Compare
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
4bd3686 to
bd33954
Compare
| // iteration. | ||
| cursor = undefined | ||
| offset += orders.length | ||
| } |
There was a problem hiding this comment.
Cursor offset fallback undercounts
High Severity
In queryNexchange, offset is only increased in the branch where nextCursor is missing, while earlier pages may have been fetched with cursor and left offset at 0. If the API later falls back to offset-based paging, the request can skip hundreds of orders or repeat an earlier page.
Reviewed by Cursor Bugbot for commit bd33954. Configure here.
Co-authored-by: Cursor <cursoragent@cursor.com>
When an asset has a contract address it is a token, but several plugins silently fell back to a native (tokenId: null) mapping when the token could not be resolved. That prices the token with the chain's gas-token rate and overcounts volume whenever the token is worth less than the gas token. - nexchange: throw when a contract-bearing asset is on a chain whose tokenType is missing, instead of returning tokenId: null. - changenow: drop the try/catch around createTokenId that swallowed failures and returned tokenId: null. - rango: drop the per-tx try/catch that logged and continued, silently dropping any transaction whose asset could not be resolved. All three plugins paginate oldest-to-newest and persist progress on throw, so a failing order halts and is retried next run rather than being mispriced or silently dropped. Also add the SUI and MONAD chain mappings to rango: these were previously dropped silently and would now halt the plugin. Verified by reprocessing the last three months of orders (nexchange 22.7k, changenow 61.9k, rango 2.9k) with zero processing failures. Co-authored-by: Cursor <cursoragent@cursor.com>
bd33954 to
130f101
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 130f101. Configure here.
| export function processNexchangeTx( | ||
| rawTx: unknown, | ||
| currencyMap: NexchangeCurrencyInfoMap | ||
| ): StandardTx { |
There was a problem hiding this comment.
processNexchangeTx wrong signature
Medium Severity
processNexchangeTx takes (rawTx, currencyMap) instead of (rawTx, pluginParams). Planned backfill tooling invokes every process*Tx with only rawTx and pluginParams, so this handler cannot load the currency catalog on its own like other partner plugins.
Triggered by learned rule: process*Tx must have uniform signature for backfill scripts
Reviewed by Cursor Bugbot for commit 130f101. Configure here.


CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
Api Key should be shared privately
Description
nexchangepartner plugin atsrc/partners/nexchange.ts.src/queryEngine.ts./audits/edge/orders) with support for:x-api-keyAuthorization: ApiKey <key>auth headerdateFromincremental sync using persistedlatestIsoDateand lookbacktest/nexchange.test.tsfor transaction mapping and auth header behavior.https://app.asana.com/1/9976422036640/project/1200382638405084/task/1213650284151456?focus=true
Note
Medium Risk
Changes how swap volume is priced when token resolution fails (ChangeNow/Rango may stop mid-sync until fixed), and new partner sync depends on catalog + audit APIs—incorrect mapping would affect reported USD volume.
Overview
Adds a new n.exchange swap partner that ingests Edge audit orders (
/audits/edge/orders) withx-api-keyauth, 5-daydateFromlookback, and cursor/offset pagination, enriching orders via the v2 currency catalog intoStandardTx(chain plugin id, token id, EVM chain id). Unknown networks/fiat stay unmapped; tokens with contracts throw instead of being treated as native so volume is not priced as the gas token.ChangeNow and Rango adopt the same rule: failed
createTokenId/ asset resolution stops the run (no silenttokenId: nullor per-tx skip). Rango also maps MONAD and SUI blockchains.Wires
nexchangeinto the query engine and demo partner list; addstest/nexchange.test.tsfor mapping, dates, and asset resolution.Reviewed by Cursor Bugbot for commit 130f101. Bugbot is set up for automated code reviews on this repo. Configure here.